﻿
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.Infrastructure.Annotations;
using System.Data.Entity.ModelConfiguration;

namespace WinnerCMS.Data.Mapping
{
    public partial class GatherMap
        : EntityTypeConfiguration<WinnerCMS.Model.Gather>
    {
        public GatherMap()
        {
            // table
            //ToTable("CMS_Gathers");

            // keys
            HasKey(t => t.Id);

            // Properties
            Property(t => t.Id)
                
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired().HasColumnAnnotation("Index",
                new IndexAnnotation(new[] 
                            { 
                                new IndexAttribute("IX_Gather",0)
                            }));
            Property(t => t.Name)
                
                .HasMaxLength(50)
                .IsOptional();
            Property(t => t.StartUrl)
                .IsUnicode(false).IsMaxLength()
                .IsOptional();
            Property(t => t.CategoryArea)
                
                .HasMaxLength(2000)
                .IsOptional();
            Property(t => t.ContentTitle)
                
                .HasMaxLength(2000)
                .IsOptional();
            Property(t => t.UpdateTime)
                
                .HasMaxLength(2000)
                .IsOptional();
            Property(t => t.ComeFrom)
                
                .HasMaxLength(2000)
                .IsOptional();
            Property(t => t.Author)
                
                .HasMaxLength(2000)
                .IsOptional();
            Property(t => t.Content)
                
                .HasMaxLength(2000)
                .IsOptional();
            Property(t => t.ContentPageUrl)
                
                .HasMaxLength(2000)
                .IsOptional();
            Property(t => t.FullArticleUrl)
                
                .HasMaxLength(2000)
                .IsOptional();
            Property(t => t.CategoryPageNextUrl)
                
                .HasMaxLength(2000)
                .IsOptional();
            Property(t => t.ContentPageNextUrl)
                
                .HasMaxLength(2000)
                .IsOptional();
            Property(t => t.IgnoreUrl)
                
                .HasMaxLength(2000)
                .IsOptional();
            Property(t => t.Filter)
                
                .HasMaxLength(4000)
                .IsOptional();
            Property(t => t.Replace)
                
                .HasMaxLength(4000)
                .IsOptional();
            Property(t => t.CanDownImg)
                
                .IsRequired();
            Property(t => t.CategoryId)
                
                .IsRequired();
            Property(t => t.LastWork)
                
                .IsOptional();
            Property(t => t.IsChecked)
                
                .IsRequired();
            Property(t => t.CanDrawWaterMark)
                
                .IsRequired();
            Property(t => t.IsExpert)
                
                .IsRequired();
            Property(t => t.PID)
                
                .IsRequired().HasColumnAnnotation("Index",
                new IndexAnnotation(new[] 
                            { 
                                new IndexAttribute("IX_Gather",1)
                            }));
            Property(t => t.IsDisabled)
                
                .IsRequired().HasColumnAnnotation("Index",
                new IndexAnnotation(new[] 
                            { 
                                new IndexAttribute("IX_Gather",2)
                            }));
            Property(t => t.CheckInTime)
                
                .IsRequired();
            Property(t => t.Encoding)
                .IsUnicode(false)
                .HasMaxLength(50)
                .IsOptional();

            // Relationships
            HasRequired(t => t.Category)
                .WithMany(t => t.Gathers)
                .HasForeignKey(d => d.CategoryId);
  

            //InitializeMapping();
        }
    }
}

